#ifndef __AGGPLOTTER_HPP
#define __AGGPLOTTER_HPP

#include <stdlib.h>
#include <stdio.h>
#include <math.h>

#include "agg_rendering_buffer.h"
#include "agg_rasterizer_scanline_aa.h"
#include "agg_conv_transform.h"
#include "agg_bspline.h"
#include "agg_ellipse.h"
#include "agg_basics.h"
#include "agg_path_storage.h"
#include "agg_conv_stroke.h"

#include "agg_gsv_text.h"
#include "agg_scanline_p.h"
#include "agg_renderer_scanline.h"

#include "agg_glyph_raster_bin.h"
#include "agg_renderer_raster_text.h"
#include "agg_embedded_raster_fonts.h"

#include "agg_renderer_primitives.h"
#include "agg_pixfmt_rgb.h"
#include "platform/agg_platform_support.h"
#include "agg_conv_contour.h"

#include <fstream>
#include <string>
#include <sstream>
#include <vector>
#include <iostream>

#include "utils.hpp"

class AggPlotter{
    int frame_width;
    int frame_height;
    
    int kCfg;
    
    int cfgNum;
    int cfgType;
    int cfgIX1, cfgIY1;
    int cfgIX2, cfgIY2;
    
    std::string cfgNameX, cfgNameY, cfgNameZ;
    double cfgX1, cfgX2, cfgX0, cfgXStep, cfgXScale;
    double cfgY1, cfgY2, cfgY0, cfgYStep, cfgYScale;
    
    double cfgZ1, cfgZ2;
    double cfgIZ1, cfgIZ2;
    
    int cfgRepeatY;
public:
    void readConfig(std::string fname);

    AggPlotter();
    
    void plotParticles(std::string fname, std::vector<double> & xx, std::vector<double> & yy, std::vector<double> & dd, std::vector<double> & vv);

    void plotAxis();
    
    void plotLines(std::string fname, std::vector<double> & xx, std::vector<double> & yy, double x0);
    
    void saveFile(std::string fname);
};

#endif
